﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'V' AND name = 'SafeTraining_View')
BEGIN
  DROP  View SafeTraining_View
END
GO
CREATE View SafeTraining_View 
AS
  SELECT A.*,B.name TrainName,C.EnterpriseName FROM  SafeTraining A 
    LEFT JOIN CommonCode B  ON A.TrainKind = B.Code
    JOIN Enterprises_View C ON A.EnterpriseID=C.EnterpriseID
GO